package chixing.day13.work;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class ProductTest {
    public static void main(String[] args) {
         Set<Product> products = new HashSet<>();
         Product p1 = new Product("电脑", 5000,1);
         Product p2 = new Product("鼠标", 20,2);
         Product p3 = new Product("键盘", 500,3);
         Product p4 = new Product("鼠标垫", 10,4);
         Product p5 = new Product("鼠标垫", 10,4);
         products.add(p1);
         products.add(p2);
         products.add(p3);
         products.add(p4);
         products.add(p5);
         for(Product p:products){
             System.out.println(p);
         }
         System.out.println("------------------------------------------------");
         List<Product> list = new ArrayList<>();
         for(Product p:products){
             if(p.getPrice()>300){
                 list.add(p);
             }
         }
         for(Product p:list){
             System.out.println(p);
         }
    }
}
